{extend name="common/layout" /}
{block name="title"}聚合DNS管理系统{/block}
{block name="main"}
<style>
.table>tbody>tr>td{white-space: normal;}
.query-title {
    background-color:#f5fafe;
    word-break: keep-all;
}
.query-result{
    word-break: break-all;
}
</style>
<div class="row">
	<div class="col-md-3 col-xs-6">
		<!-- small box -->
		<div class="small-box bg-aqua">
		<div class="inner">
			<h3 id="count1">0</h3>
			<p>域名数量</p>
		</div>
		<div class="icon">
			<i class="fa fa-list-ul"></i>
		</div>
		<a href="/domain" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
		</div>
	</div>
	<!-- ./col -->
	<div class="col-md-3 col-xs-6">
		<!-- small box -->
		<div class="small-box bg-green">
		<div class="inner">
			<h3 id="count2">0</h3>
			<p>用户数量</p>
		</div>
		<div class="icon">
			<i class="fa fa-users"></i>
		</div>
		<a href="/user" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
		</div>
	</div>
	<!-- ./col -->
	<div class="col-md-3 col-xs-6">
		<!-- small box -->
		<div class="small-box bg-yellow">
		<div class="inner">
			<h3 id="count3">0</h3>
			<p>解析数量</p>
		</div>
		<div class="icon">
			<i class="fa fa-globe"></i>
		</div>
		<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
		</div>
	</div>
	<!-- ./col -->
	<div class="col-md-3 col-xs-6">
		<!-- small box -->
		<div class="small-box bg-red">
		<div class="inner">
			<h3 id="count4">0</h3>
			<p>平台数量</p>
		</div>
		<div class="icon">
			<i class="fa fa-connectdevelop"></i>
		</div>
		<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
		</div>
	</div>
	<!-- ./col -->
</div>
<!-- /.row -->
<div class="row">
    <div class="col-md-7 col-sm-12">
        <div id="browser-notice"></div>
        <div class="box box-primary">
            <div class="box-header with-border">
                <i class="fa fa-cloud"></i>
                <h3 class="box-title">服务器信息</h3>
            </div>
            <table class="table table-bordered">
                <tbody>
                <tr>
                    <td class="query-title">框架版本</td>
                    <td class="query-result">{$info.framework_version}</td>
                </tr>
                <tr>
                    <td class="query-title">PHP版本</td>
                    <td class="query-result">{$info.php_version}</td>
                </tr>
                <tr>
                    <td class="query-title">MySQL版本</td>
                    <td class="query-result">{$info.mysql_version}</td>
                </tr>
                <tr>
                    <td class="query-title">WEB软件</td>
                    <td class="query-result">{$info.software}</td>
                </tr>
                <tr>
                    <td class="query-title">操作系统</td>
                    <td class="query-result">{$info.os}</td>
                </tr>
                <tr>
                    <td class="query-title">服务器时间</td>
                    <td class="query-result">{$info.date}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="col-md-5 col-sm-12">
        <div class="box box-default">
            <div class="box-header with-border">
                <i class="fa fa-volume-up"></i>
                <h3 class="box-title">版本信息</h3>
            </div>
            <ul class="list-group text-dark" id="checkupdate"></ul>
        </div>
		<button class="btn btn-default btn-block" onclick="cleancache()"><i class="fa fa-trash"></i>清理缓存</button><br/>
    </div>
</div>
{/block}
{block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script>
$(document).ready(function(){
    $.ajax({
		type : "POST",
		url : "/",
        data : {do: 'stat'},
		dataType : 'json',
		success : function(data) {
            $('#count1').html(data.domains);
			$('#count2').html(data.users);
			$('#count3').html(data.records);
            $('#count4').html(data.types);
            $.ajax({
				url: '{$checkupdate}',
				type: 'get',
				dataType: 'jsonp',
				jsonpCallback: 'callback'
			}).done(function(data){
				$("#checkupdate").html(data.msg);
			})
        }
    })
})
function cleancache(){
	var ii = layer.load(2);
	$.ajax({
		type : 'GET',
		url : '/cleancache',
		dataType : 'json',
		success : function(data) {
			layer.close(ii);
			layer.msg('清理缓存成功', {icon: 1});
		},
		error:function(data){
            layer.close(ii);
			layer.msg('服务器错误');
		}
	});
}
</script>
<script>
function speedModeNotice(){
	var ua = window.navigator.userAgent;
	if(ua.indexOf('Windows NT')>-1 && ua.indexOf('Trident/')>-1){
		var html = "<div class=\"panel panel-default\"><div class=\"panel-body\">当前浏览器是兼容模式，为确保后台功能正常使用，请切换到<b style='color:#51b72f'>极速模式</b>！<br>操作方法：点击浏览器地址栏右侧的IE符号<b style='color:#51b72f;'><i class='fa fa-internet-explorer fa-fw'></i></b>→选择“<b style='color:#51b72f;'><i class='fa fa-flash fa-fw'></i></b><b style='color:#51b72f;'>极速模式</b>”</div></div>";
		$("#browser-notice").html(html)
	}
	else if(window.location.protocol.indexOf("https")==-1){
		var html = "<div class=\"panel panel-default\"><div class=\"panel-body\"><b style='color:#CC3022;'><i class='fa fa-info-circle fa-fw'></i></b>当前正在使用HTTP访问，可能存在被窃取敏感信息风险，请使用HTTPS访问！</div></div>";
		$("#browser-notice").html(html)
	}
}
speedModeNotice();
</script>
{/block}